package com.getword.domain;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Document(collection = "article")
@Setter
@Getter
@ToString
public class Article  implements Serializable {
    @Id
    @Field("_id")
    private String id;
    private String title;
    private String content;
    private Date releaseTime;
    private Long zan;
    private Long readCount;
    private String summary;
    private Boolean deleted = false;
    // 情感分析
    private ArticleSentiment sentiment;


    @Transient
    private Boolean isZan;
    @DBRef
    private User user;  // 作者
    @DBRef
    private OutlineDetail outlineDetail;
    @DBRef
    private Course course;

    public Article() {
    }

    public Article(String id) {
        this.id = id;
    }
}
